﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace GameJam
{
    public class Entity : MonoBehaviour
    {
        protected MoveHandler moveHandler;
        // Use this for initialization
        void Start()
        {
            moveHandler = new MoveHandler();
        }

        // Update is called once per frame
        void Update()
        {

        }

        private void UnableMoveDir(DIR dir)
        {
            switch (dir)
            {
                case DIR.LEFT:
                    moveHandler.isCanMoveLeft = false;
                    break;
                case DIR.RIGHT:
                    moveHandler.isCanMoveRight = false;
                    break;
                case DIR.UP:
                    moveHandler.isCanMoveUp = false;
                    break;
                case DIR.DOWN:
                    moveHandler.isCanMoveDown = false;
                    break;
            }
        }

        protected void needResetDir()
        {
            moveHandler.isnNeedResetDir = true;
        }
    }

    public class MoveHandler
    {
        public bool isCanMoveLeft = true;
        public bool isCanMoveRight = true;
        public bool isCanMoveUp = true;
        public bool isCanMoveDown = true;
        public bool isnNeedResetDir;

        public void reset()
        {

            if (isnNeedResetDir)
            {
                isCanMoveLeft = true;
                isCanMoveRight = true;
                isCanMoveUp = true;
                isCanMoveDown = true;
                isnNeedResetDir = false;
            }
        }
    }

    public enum DIR
    {
        LEFT,
        RIGHT,
        UP,
        DOWN
    }
}